<%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2022/10/4
  Time: 21:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>requestTest</title>
    <script src="${pageContext.request.contextPath}/webjars/jquery/3.6.0/jquery.min.js"></script>

</head>
<body>
<input type="button" value="发起请求" id="but">
<br>
<span id="msg"></span>
</body>
<script>
    $("#but").click(
        function () {
            $.ajax({
                url: '${pageContext.request.contextPath}/analyze?name=张三',
                type: 'post',
                data: JSON.stringify(
                    {
                        stuId: '20221001',
                        place: '火星',
                        phone: '110'
                    }
                ),
                contentType: "application/json",
                success: function (resp) {
                    $("#msg").text(JSON.stringify(resp));
                }
            });
        }
    );
</script>
</html>
